<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../plugins/vue.min.js"></script>
</head>
<body>
    <div id="box">
        <input type="text" v-model="myUsername">
    </div>
    <script>
        let vm = new Vue({
            el:"#box",
            data:{
                myUsername:'huhu'
                },
                watch:{
                    // 不用写返回值,监视作用,参数为新值,旧值,重视过程
                    myUsername(newValue,oldValue){
                        console.log(newValue,oldValue)
                    }
                }    
        })

       

    </script>
</body>
</html>